home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_boulderfalltemp.cog < prev    next >
Text File  |  1999-11-15  |  10KB  |  341 lines

  1. # Jones 3D Cog Script
  2. #
  3. # PRU_boulderfall.cog    Boulder falls straight down and smashes Indy.
  4. #
  5. # [GGJ]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10. symbols
  11.  
  12. message     startup
  13. message     entered
  14. message        touched
  15. message        arrived
  16. message        damaged
  17. message        pulse
  18.                      
  19. thing       player          local
  20. thing        deadindy        local        nolink           
  21. thing       rubble            mask=0x08
  22. thing       boulder
  23. thing        debris
  24. thing         camera0
  25. thing        camera1
  26. thing        camera2
  27. thing        camera3
  28. thing        camera4
  29. thing        fallingrubble    local
  30. thing        smashedghost
  31. thing        columnTarget0
  32. thing        columnTarget1
  33. thing        columnTarget2
  34. thing        columnTarget3
  35. thing        whipCam
  36. thing        fallTarget0
  37. thing        smokeGhost
  38. thing        smoke            local
  39.  
  40. surface        skull0            linkID=4
  41. surface        entry
  42. surface        boulderplatform0
  43.  
  44. sector        columnbottom    mask=0x080
  45.  
  46. keyframe    smashed=in_die_buckle.key                    local
  47.  
  48. sound        sndDie=tem_temspikes_up_kill_c.wav            local
  49. sound        bldrshift=teo_teobut_pull_c.wav                local
  50. sound        debrisfall=tem_tikidoor_tikikeymove_c.wav    local
  51. sound        boulderfall=pru_boulder_crash_c.wav            local
  52. sound        rubblefall=olv_rockhead_hitearth_c.wav        local
  53. sound        triggered=olv_presswitch_c.wav                local
  54.  
  55. template    tempRef=indy_sh_actor                           local
  56. template    fallrbletemplate=physrbl                    local                        
  57. template    standbouldertpl=bldrsmash                    local
  58. template    smoketemplate=+bouldersmoke_spr                local
  59.  
  60. int            once=0        local    
  61. int            deadIndy    local
  62. int            curCam        local
  63. int            indy        local
  64. int            fallen=0    local
  65. int            hit=0        local
  66. int            tempCam        local
  67.  
  68. vector        posOffset    local
  69. vector        angOffset    local
  70.  
  71. flex        posDelta=0.0    local
  72. flex        angDelta=180.0    local
  73.  
  74. end
  75.  
  76. # ========================================================================================
  77. code
  78. startup:
  79.     player = GetLocalPlayerThing();
  80.  
  81. //    SetPulse(3.0);
  82.  
  83.     return;
  84. # =========================================================================================
  85. entered:
  86.     if ((GetSenderRef() == entry) && (once == 0))
  87.     {
  88.         once = 1;
  89.         curCam = GetCurrentCamera();
  90.         ResetCameraFOV(0, 0.0);
  91.  
  92.         StartCutscene(1);
  93.         
  94.         #Stop the player from moving and put him in a standing position
  95.         StopThing(player);
  96.         PlayMode(player, 1, 0);
  97.         
  98.         #create an actor
  99.         indy = CreateThing(TempRef, player);
  100.         CaptureThing(indy);
  101.         SetThingFlags(player, 0x80000);
  102.         SetActorFlags(player, 0x200000);
  103.         ClearThingFlags(indy, 0x80000);
  104.         AISetMoveSpeed(indy, 1.0);
  105.         
  106.         #set a camera looking at the actor
  107.         SetCameraLookInterp(2, 0);
  108.         SetCameraPosInterp(2, 0);
  109.         SetCameraFocus(2, camera0);
  110.         SetCameraSecondaryFocus(2, columnTarget3);
  111.         SetCurrentCamera(2);
  112.         SetCameraFOV(90, 0, 0.0);
  113.         
  114.         #Walk the actor to the column
  115.         AISetMoveThing(indy, columnTarget2, 1);
  116.         
  117.         #Indy knocks the debris onto the trigger plate on the floor
  118.         SetCameraLookInterp(2, 1);
  119.         SetCameraPosInterp(2, 1);
  120.         SetCameraInterpSpeed(2, 1.0);
  121.  
  122.         Sleep(0.3);
  123.         MoveToFrame(debris, 1, 1);
  124.         
  125.         Sleep(0.2);
  126.         SetCameraFOV(40, 1, 1.0);
  127.         
  128.         SetCameraSecondaryFocus(2, columnTarget0);
  129.         
  130.         Sleep(1.0);
  131.         
  132.         SetCameraFOV(60, 1, 5.0);
  133.         WaitForStop(debris);
  134.         Sleep(0.2);
  135.         AISetLookThing(indy, debris);
  136.         MoveToFrame(debris, 2, 5);
  137.         MoveToFrame(columnTarget0, 1, 4.0);
  138.     }
  139.  
  140.     if ((GetSourceRef() == player) && (GetSenderID() == 4))
  141.         { 
  142.         PlaySoundThing(triggered, player, 1.0, -1.0, -1.0, 0x0);
  143.         Print("player entered skull");
  144.         
  145.         #Indy steps on the trigger plate, causing the boulder to fall on him
  146.         StartCutscene(1);
  147.         SetCameraFocus(2, camera1);
  148.         SetCameraSecondaryFocus(2, fallTarget0);
  149.         SetCurrentCamera(2);
  150.         SetCameraFOV(90, 1, 1.0);
  151.         MoveToFrame(boulder, 2, 20);
  152.         Sleep(2.0);
  153.         posOffSet = VectorSet(0.0, 0.0, 0.0);
  154.         angOffSet = VectorSet(7, RandBetween(-2, 2), RandBetween(-2, 2));
  155.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  156.         Sleep(1.5);
  157.         EndCutscene();                      
  158.         }
  159.      
  160.     #when the rubble falls on the skull face, the boulder will fall
  161.     if (GetSourceRef() == fallingRubble)
  162.     {
  163.         PlaySoundThing(rubblefall, fallingRubble, 1.0, -1.0, -1.0, 0x0);
  164.         PlaySoundThing(triggered, fallingRubble, 1.0, -1.0, -1.0, 0x0);
  165.         Sleep(0.5);
  166.         
  167.         SetCameraLookInterp(2, 0);
  168.         SetCameraSecondaryFocus(2, boulder);
  169.         SetCameraFOV(100, 0, 0.0);
  170.         Sleep(1.0);
  171.         
  172.         MoveToFrame(boulder, 2, 20);
  173.         fallen = 1;
  174.         Sleep(2.0);
  175.         SetCurrentCamera(curCam);
  176.         ResetCameraFOV(0, 0.0);
  177.     }
  178.         
  179.     return;
  180. # =========================================================================================
  181. arrived:
  182.     if ((GetSenderRef() == debris) && (GetCurFrame(debris) == 1))
  183.     {
  184.         angOffSet = VectorSet(0.05, 0.05, 0.05);
  185.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  186.         Sleep(0.05);
  187.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  188.         PlaySoundThing(debrisfall, debris, 1.0, -1.0, -1.0, 0x0);
  189.  
  190.         return;
  191.     }
  192.  
  193.     if ((GetSenderRef() == debris) && (GetCurFrame(debris) == 2))
  194.     {
  195.         Sleep(0.75);
  196.         #SetCameraFOV(70, 1, 2.0);
  197.         
  198.         #Debris hits the floor, triggering the boulder
  199.         PlaySoundThing(debrisfall, debris, 1.0, -1.0, -1.0, 0x0);
  200.         Sleep(0.75);
  201.         PlaySoundThing(triggered, debris, 1.0, -1.0, -1.0, 0x0);
  202.         
  203.         #shake the camera as the trap is partially triggered
  204.         angOffSet = VectorSet(0.1, 0.1, 0.1);
  205.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  206.         Sleep(0.05);
  207.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  208.         Sleep(0.05);
  209.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  210.         Sleep(0.05);
  211.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  212.         Sleep(0.05);
  213.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  214.         Sleep(0.5);
  215.         
  216.         SetCameraLookInterp(2, 1);
  217.         SetCameraPosInterp(2, 1);
  218.         SetCameraInterpSpeed(2, 2.5);
  219.         Sleep(0.1);
  220.         SetCameraSecondaryFocus(2, columnTarget1);
  221.         Sleep(0.5);
  222.         
  223.         SetCameraFocus(2, camera3);
  224.         #SetCameraSecondaryFocus(2, columnTarget1);
  225.         SetCurrentCamera(2);
  226.         #MoveToFrame(columnTarget1, 1, 0.8);
  227.         
  228.         
  229.         MoveToFrame(boulder, 1, 0.2);
  230.         AISetLookThing(indy, boulder);
  231.         Sleep(2.0);
  232.         
  233.         PlaySoundThing(bldrshift, boulder, 1.0, -1.0, -1.0, 0x0);
  234.         posOffset = VectorSet(Rand()*0.1, Rand()*0.1, Rand()*0.1);
  235.         angOffset = VectorSet(Rand(), Rand(), Rand());
  236.         #SetPOVShake(posOffset, angOffset, .5, 80.0);
  237.         
  238.         Sleep(4.5);
  239.  
  240.         CopyOrientandPos(indy, player);
  241.         tempCam = GetThingPos(camera4);
  242.         SetCameraPosition(curcam, tempCam);
  243.         SetCurrentCamera(curCam);
  244.         SetThingFlags(indy, 0x80000);
  245.         ClearThingFlags(player, 0x80000);
  246.         ClearActorFlags(player, 0x200000);
  247.         
  248.         debugprint("leaving boulder arrived");
  249.         
  250.         EndCutscene();
  251.  
  252.         return;
  253.     }
  254.  
  255.     if (GetCurFrame(boulder) == 2)
  256.     {
  257.         PlaySoundThing(boulderfall, boulder, 1.0, -1.0, -1.0, 0x0);
  258.         posOffSet = VectorSet(0.0, 0.0, 0.0);
  259.         angOffSet = VectorSet(7, RandBetween(-2, 2), RandBetween(-2, 2));
  260.         SetPOVShake(posOffSet, angOffSet, posDelta, angDelta);
  261.         ClearAdjoinFlags(boulderplatform0, 0x2);
  262.         DestroyThing(boulder);
  263.  
  264.         #Pat!  Cloud of smoke needed!
  265.  
  266.         smoke = CreateThing(smoketemplate, smokeGhost);
  267.         AnimateSpriteSize(smoke, '0.05 0.05 1.0', '0.35 0.35 0.0', 3.0);
  268.  
  269.         standBoulder = CreateThing(standbouldertpl, smashedghost);
  270.         CaptureThing(standBoulder);
  271.  
  272.         Sleep(3.0);
  273.  
  274.         return;
  275.     }
  276.         return;
  277. # =========================================================================================
  278. touched:
  279.     If ((GetSenderRef() == boulder) && (GetSourceRef() == player) && (fallen == 0))
  280.         {
  281.         Print("boulder touched player");
  282.         DamageThing(player, 1000.0, 0x1, victim);
  283.         SetCollideType(boulder, 0);
  284.         PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  285.         SetThingFlags(player, 0x80000);
  286.         deadIndy = CreateThing(tempRef, player);
  287.         CaptureThing(deadIndy);
  288.         ClearThingFlags(deadindy, 0x80000);
  289.         PlayKey(deadindy, smashed, 4, 0x14, 0);
  290.         StartCutscene(1);
  291.         SetCameraFocus(2, camera2);
  292.         SetCameraSecondaryFocus(2, smashedGhost);
  293.         SetCurrentCamera(2);
  294.         SetCameraFOV(90, 1, 1.0);
  295.         Sleep(2.0);
  296.         posOffset = VectorSet(Rand()*0.01, Rand()*0.01, Rand()*0.01);
  297.         angOffset = VectorSet(Rand(), Rand(), Rand());
  298.         SetPOVShake(posOffset, angOffset, .5, 80.0);
  299.         Sleep(1.5);
  300.         EndCutscene();    
  301.         }
  302.     return;
  303.  
  304. # ========================================================================================
  305. damaged:
  306.     
  307.     if (hit == 1) return;
  308.  
  309.     if ((GetSenderRef() == rubble) && (GetParam(1) == 0x10))
  310.     {
  311.         curCam = GetCurrentCamera();
  312.         
  313.         fallingRubble = CreateThing(fallrbletemplate, rubble);
  314.         CaptureThing(fallingRubble);
  315.         
  316.         StartCutscene(1);
  317.         SetCameraFocus(2, whipCam);
  318.         SetCameraSecondaryFocus(2, fallingRubble);
  319.         SetCurrentCamera(2);
  320.         Sleep(0.5);
  321.         
  322.         DestroyThing(rubble);
  323.         
  324.         direction = VectorSet(-1.0, -1.0, 0.1);
  325.         DetachThing(fallingrubble);
  326.         ApplyForce(fallingrubble, VectorScale(direction, 0.005));
  327.         Sleep(1.0);
  328.         hit = 1;
  329.         fallen = 1;
  330.     }
  331.     return;
  332.  
  333. pulse:
  334.     smoke = CreateThing(smoketemplate, smokeGhost);
  335.     AnimateSpriteSize(smoke, '0.01 0.01 1.0', '0.3 0.3 0.0', 2.0);
  336.     return;
  337.  
  338. end
  339.  
  340. # ======================================================================================== 
  341.